package com.jdz.service.impl;

import com.jdz.common.ServerResponse;
import com.jdz.dao.GroupUserMapper;
import com.jdz.pojo.GroupUser;
import com.jdz.service.IGroupUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

@Service("IGroupUserService")
public class GroupUserServiceImpl implements IGroupUserService {

    @Autowired
    GroupUserMapper groupUserMapper;

    public  ServerResponse add(Integer stuno, Integer groupno){
        if(stuno==0||stuno==null||groupno==0||groupno==null){
            return  ServerResponse.createByErrorMessage("输入参数错误");
        }
        GroupUser groupUser = new GroupUser();
        groupUser.setstuno(stuno);
        groupUser.setGroupno(groupno);
        groupUser.setCreattime(new Date());
        int i = groupUserMapper.insertSelective(groupUser);

        if(i<=0){
            return ServerResponse.createByErrorMessage("添加失败");
        }
        return ServerResponse.createBySuccessMessage("添加成功");
    }

}
